# # coding=utf-8

# from . import base
# from .component import Component


# ## 实现一个组件，需要写如下几个方法：
# class Wget(Component):


#     ## 依赖的组件，返回类型为 string 数组，例如 return ["docker"]，表示该组件依赖的其他组件
#     def dependencies(self):
#         if base.is_windows():
#             return []
#         else:
#             return []


#     ## 检测安装状态，返回true或者false，用于显示是否已经安装该组件
#     def check(self):
#         if base.is_windows():
#             return True;
#         else:
#             ret = base.cmd("wget", "-v")
#             return ret == 0;



#     ## 检测运行状态，返回true或者false，表示该组件是否正在运行
#     def status(self):
#         ## 因为wget不是一个服务，所以就当作一直在运行
#         return True;


#     ## 安装 组件需要运行的命令行
#     def install(self, rVersion : str = None):
#         EN_PATH = base.get_env("EN_PATH")
#         if not base.is_windows():
#             if base.os_name() == 'centos':
#                 base.cmd("yum", ["install", "wget", "-y"])
#             else:
#                 base.cmd("apt", ["install", "wget", "-y"])


#     ## 更新
#     def update(self, rVersion : str = None):
#         self.install()


#     ## 卸载
#     def uninstall(self):
#         if base.os_name() == 'centos':
#             # base.cmd("yum", ["remove", "wget", "-y"])
#             pass
#         else:
#             base.cmd("apt", ["remove", "wget", "-y"])


# from . import component_manager as cm
# cm.ALL_COMPONENTS['wget'] = Wget()